/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 combat_path.h

	$Header: /heroes4/combat_path.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( COMBAT_PATH_H_INCLUDED )
#define COMBAT_PATH_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

// kill the 255+ character identifier warning.  Templates tend to exceed that easily.
#pragma warning( disable: 4786 )

#include <vector>
#include "direction.h"
#include "map_point.h"

// ---------------------------------------------------------------
// information needed about a point on the map during pathfinding
// ---------------------------------------------------------------
struct t_combat_path_data
{
	unsigned short  entry_cost;
	unsigned short  flight_cost;      // # of squares which must be flown over to reach this point
	unsigned short	move_cost;		  // cost in movement points to this point.
	unsigned int	visited			: 1;  // if this is a primary path cell
	unsigned int    reachable		: 1;  // if any part of army can touch this cell
	unsigned int    blocked			: 1;  // true if this square cannot be entered.
	unsigned int	forbidden		: 1;  // true if this square overlaps forbidden squares
	unsigned int    off_map			: 1;  // true if this square is illegal
	unsigned int    is_tower		: 1; // true if this square is an arrow tower
	unsigned int	has_wall		: 1; // true if being in this square overlaps a castle wall
	unsigned int	attackable		: 1; // true if tile can be melee attacked
	unsigned int	attack_distance	: 5; // melee attack distance in tiles * 2
	t_direction		direction		: 5;
	t_map_point_2d  last_point;		  // previous point in path.
	t_map_point_2d  nearest_point;    // location of primary path cell if this is a destination
};

inline bool operator > ( t_combat_path_data const& left, t_combat_path_data const& right )
{
	return left.move_cost > right.move_cost;
}

// ---------------------------------------------------------------
// class to store information about a single point in a path
// ---------------------------------------------------------------
struct t_combat_path_point : public t_combat_path_data, public t_map_point_2d
{
	t_combat_path_point();
	explicit t_combat_path_point( t_map_point_2d const& arg );
	t_combat_path_point( t_map_point_2d const& point, t_combat_path_data const& data );
};

inline t_combat_path_point::t_combat_path_point()
{
}

inline t_combat_path_point::t_combat_path_point( t_map_point_2d const& arg )
                             : t_map_point_2d( arg )
{
}

inline t_combat_path_point::t_combat_path_point( t_map_point_2d const& point, 
												 t_combat_path_data const& data )
						  : t_map_point_2d( point ), t_combat_path_data( data )
{
}
	
// ---------------------------------------------------------------
// class to store a completed path
// ---------------------------------------------------------------
class t_combat_path : public std::vector<t_combat_path_point>
{
};

#endif // ADVENTURE_PATH_H_INCLUDED